import org.dom4j.Document;
import org.dom4j.Element;

import java.io.File;

/**
 * @author dreamcatcher
 * @date 2022/5/4 15:38
 */
public class ManifestLoader {
    /**
     * 使用反射通过manifest.xml文件创建入口Activity
     * @param args
     * @throws Exception
     */
     public static void main(String[] args) throws Exception {
        File file = new File("manifest/manifest.xml");
        Document document = LayoutLoader.parse(file);
        Element rootElement = document.getRootElement();
        Element main = rootElement.element("Main");
        String s = main.attributeValue("entry");

        Class<?> aClass = Class.forName(s.substring(1));

        Activity app = (Activity) aClass.newInstance();
        app.run();
    }
}
